package com.readbook.action;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.readbook.fileimage.ImgEditor;
import com.readbook.service.WechartService;
import com.readbook.util.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.util.*;

@Controller
@RequestMapping("/upload")
public class upload {

    //图片检测
    @RequestMapping("imgSecCheck.html")
    public @ResponseBody
    Map<String, Object> imgSecCheck(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            param.put("result", false);
            param.put("msg", "获取空数据");
            return param;
        }
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            int m=0;
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                //图片格式检测
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    String geshi=extName.substring(1,extName.length()).toUpperCase();
                    //要检测的图片文件，格式支持PNG、JPEG、JPG、GIF，图片尺寸不超过 750px x 1334px
                    if(!geshi.equals("PNG") && !geshi.equals("JPEG") && !geshi.equals("JPG") && !geshi.equals("GIF")){
                        param.put("result", false);
                        param.put("msg", "图片格式错误");
                        return param;
                    }
                }
                
                //图片检测-小程序验证是否正确
                param = SecCheck.imgSecCheck(mf);
                if(param.get("result").toString().equals("false")){
                    return param;
                }

                m++;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("result", true);
        param.put("msg", "图片检测正确");
        return param;
    }


    /*
     *  微信上传图片
     */
    @RequestMapping("uploadwx.html")
    public @ResponseBody
    Map<String, Object> uploadwx(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String savefile=request.getParameter("savefile");
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + savefile;
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);

                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//" +savefile+ "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }



    /*
     * 上传学生阅读剪影的图片
     */
    @RequestMapping("uploadYdjyurl.html")
    public @ResponseBody
    Map<String, Object> uploadYdjyurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "ydjy";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//ydjy" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("result", true);
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传学生好词好句好段的图片
     */
    @RequestMapping("uploadBookHchjhdurl.html")
    public @ResponseBody
    Map<String, Object> uploadBookHchjhdurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "hchjhd";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//hchjhd" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传学生章节读后感的图片
     */
    @RequestMapping("uploadBookZjdhgurl.html")
    public @ResponseBody
    Map<String, Object> uploadBookZjdhgurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "zjdhg";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//zjdhg" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    @RequestMapping("/filesUploadBookfm.html")
    public @ResponseBody
    List<Object> filesUploadBookfm(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();

        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "bookfm");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


    @RequestMapping("/filesUploadTopImage.html")
    public @ResponseBody
    List<Object> filesUploadTopImage(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();
        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "topimage");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


    @RequestMapping("/filesUploadHxtdImage.html")
    public @ResponseBody
    List<Object> filesUploadHxtdImage(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();
        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "hxtdtop");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


    @RequestMapping("/filesUploadScdhImage.html")
    public @ResponseBody
    List<Object> filesUploadScdhImage(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();
        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "scdhtop");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


    /*
     * 上传学生心得体会的图片
     */
    @RequestMapping("uploadXdthurl.html")
    public @ResponseBody
    Map<String, Object> uploadXdthurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "xdth";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//xdth" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传书籍推荐的图片
     */
    @RequestMapping("uploadbooktjfmurl.html")
    public @ResponseBody
    Map<String, Object> uploadbooktjfmurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "tjfm";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//tjfm" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传诗词大会的图片
     */
    @RequestMapping("uploadScdhFm.html")
    public @ResponseBody
    Map<String, Object> uploadScdhFm(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "scdhfm";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//scdhfm" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传音乐文件
     */
    @RequestMapping("uploadMusicurl.html")
    public @ResponseBody
    Map<String, Object> uploadMusicurl(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "music";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//music" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传学生原创作品
     */
    @RequestMapping("uploadXsycImage.html")
    public @ResponseBody
    Map<String, Object> uploadXsycImage(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "xsyczp";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//xsyczp" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }


    /*
     * 上传背诵的诗词语音
     */
    @RequestMapping("uploadReadLog.html")
    public @ResponseBody
    Map<String, Object> uploadReadLog(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> param = new HashMap<String, Object>();
        MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request;
        if (mhsr == null) {
            return param;
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        try {
            mhsr.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        String se = File.separator;
        String savePath = mhsr.getRealPath("upload") + se + "readlog";
        File f1 = new File(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        String strfile = "";
        try {
            Map<String, MultipartFile> files = mhsr.getFileMap();
            for (String key : files.keySet()) {
                MultipartFile mf = mhsr.getFile(key);
                String name = mf.getOriginalFilename();
                String extName = "";
                if ((name != null) && (!name.trim().equals(""))) {
                    if (name.lastIndexOf(".") >= 0) {
                        extName = name.substring(name.lastIndexOf("."));
                    }
                    Long fname = Long.valueOf(System.nanoTime());
                    File file = new File(savePath + se + fname + extName);
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    mf.transferTo(file);
                    strfile = "upload\\//readlog" + "\\//" + fname + extName;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        param.put("urls", strfile);
        return param;
    }









    @RequestMapping("/filesUploadSCfm.html")
    public @ResponseBody
    List<Object> filesUploadSCfm(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();

        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "scdhfm");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


    @RequestMapping("/filesUploadmusic.html")
    public @ResponseBody
    List<Object> filesUploadmusic(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();

        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "scdhfm");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }



    @RequestMapping("/uploadStudenturl.html")
    public @ResponseBody
    List<Object> uploadStudenturl(@RequestParam(value = "file") MultipartFile[] files, HttpServletRequest request, HttpSession session) throws IOException {
        List<Object> fileurllist = new ArrayList<Object>();
        Map<String, Object> fileMap = new HashMap<String, Object>();
        if (files != null && files.length > 0) {
            //循环获取file数组中得文件
            for (int i = 0; i < files.length; i++) {
                MultipartFile file = files[i];
                //保存文件
                Map<String, Object> fileurl = new ImgEditor().uploadFilemapGetFilename(file, request, session, "student");
                fileurllist.add(fileurl);
            }
        }
        return fileurllist;
    }


}
